<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
    <div class="layui-form timo-compile">
    <form th:action="@{/sync/flownacos/save}">
        <input type="hidden" name="id" th:if="${flowNacos}" th:value="${flowNacos.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="title" placeholder="请输入标题" th:value="${flowNacos?.title}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属版本</label>
            <div class="layui-input-inline">
                <div  class="layui-select" th:replace="/common/fragment :: selectTag('version_id',${versions},${flowNacos?.version_id},'id','version','')"></div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">Data ID</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="data_id" placeholder="请输入Data ID" th:value="${flowNacos?.data_id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">Group</label>
            <div class="layui-input-inline">
                <select class="timo-search-select layui-input" name="group_id" mo:dict="SYNC_NACOS_GROUP_NAMES" mo-selected="${flowNacos?.group_id}"></select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否新增的文件</label>
            <div class="layui-input-inline">
                <label>
                    是<input id="add_flag_yes" class="layui-form-radio" type="radio" th:name="add_flag" value="1" th:checked="${flowNacos?.add_flag=='1'}">
                </label>
                <label>
                    否<input id="add_flag_no" class="layui-form-radio" type="radio" th:name="add_flag" value="0" th:checked="${flowNacos?.add_flag==null || flowNacos?.add_flag=='0'}">
                </label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新增的配置</label>
            <div class="layui-input-inline">
                <textarea class="layui-textarea" name="add_content" placeholder="请输入nacos配置的内容" th:utext="${flowNacos?.add_content}"></textarea>
            </div>
        </div>
        <div class="layui-form-item" id="changeDiv">
            <label class="layui-form-label">变更的配置</label>
            <div class="layui-input-inline">
                <textarea class="layui-textarea" name="change_content" placeholder="请输入nacos配置的内容" th:utext="${flowNacos?.change_content}"></textarea>
            </div>
        </div>
        <div class="layui-form-item timo-finally">
            <button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>
<script th:replace="/common/template :: script"></script>
<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
<script>
    $('#add_flag_yes').click(function(){
        $('#changeDiv textarea').prop('disabled',true);
        $('#changeDiv').hide();
    });
    $('#add_flag_no').click(function(){
        $('#changeDiv').show();
        $('#changeDiv textarea').prop('disabled',false);
    });
</script>
</body>
</html>